#include<stdio.h>
#include<conio.h>
#include<math.h>
struct phanso
{
       int tu,mau;
};
void nhap(phanso &s)
{
     printf("\n nhap tu so");
     scanf("%d",&s.tu);
     printf("\n nhap mau so");
     scanf("%d",&s.mau);
}
void xuat(phanso s)
{
     printf("\n phan so vua nhap la:");
     printf("%d/%d",s.tu,s.mau);
} 


phanso tong(phanso a,phanso b)
{
	phanso kq;
	kq.tu=a.tu*b.mau+a.mau*b.tu;
	kq.mau=a.mau*b.mau;
	return kq;
}
phanso hieu(phanso a,phanso b)
{ 
	phanso kq;
	kq.tu=a.tu*b.mau-a.mau*b.tu;
    kq.mau=a.mau*b.mau;
    return kq;
}
phanso tich(phanso a,phanso b)
{ 
	phanso kq;
	kq.tu=a.tu*b.tu;
    kq.mau=a.mau*b.mau;
    return kq;
}
phanso thuong(phanso a,phanso b)
{ 
	phanso kq;
	kq.tu=a.tu*b.mau;
    kq.mau=a.mau*b.tu;
    return kq;
}

int main()
{
 phanso x;
 phanso y;
 nhap(x);
 xuat(x);
 nhap(y);
 xuat(y);
 printf("\n tong 2 pso la %d/%d",tong(x,y).tu,tong(x,y).mau);
 printf("\n hieu 2 pso la %d/%d",hieu(x,y).tu,hieu(x,y).mau);
 printf("\n tich 2 pso la %d/%d",tich(x,y).tu,tich(x,y).mau);
 printf("\n thuong 2 pso la %d/%d",thuong(x,y).tu,thuong(x,y).mau);

    getch();
}
